const GoodsComments = require("../../model/goodsComments")

module.exports = async(req, res) => {
    const { _id } = req.body;
    let resData = {
        data: req.body,
        meta: {
            code: 200,
            msg: "已删除留言!",
        },
    };
    let myShopCar = await GoodsComments.findOne({ _id });
    if (myShopCar != null) {
        let result = await GoodsComments.findOne({ _id }).deleteOne();
        if (result.deleteCount == 1) {
            resData.meta.code = 200;
            resData.meta.msg = "已删除留言!";
        }
    }else {
        resData.meta.code = 400;
        resData.meta.msg = "未找到对应的留言!";
    }
    // console.log(myShopCar);
    res.send(resData);
}